<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>渠道放开设置表 管理</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<form id="insChnOpenSetting_form">
    <div class="fieldset1 tabel_col tabel_col_1 clearFix">

        <div class="fieldBox col_100_auto">
            <div class="label">政策名称</div>
            <div class="field">
                <input ligerui="width:370" name="policyNm" id="policyNm" class="ui-textbox"
                       value="${insChnOpenSettingVO.policyNm}" validate="{required:true,maxlength:120}">
                <span class="requiredSymbol">*</span>
            </div>
        </div>
        <div class="fieldBox col_100">
            <div class="label">有效期</div>
            <div class="field">
                <input name="expBgDt" id="expBgDt" class="ui-datepicker" value="${expBgDts}"
                       validate="{required:true}">-
                <input name="expEndDt" id="expEndDt" type="text" class="ui-datepicker"
                       value="${expEndDts}" validate="{required:true}">
                <span class="requiredSymbol">*</span>
            </div>
        </div>
        <div class="fieldBox col_100_auto">
            <div class="label">适用组织架构</div>
            <div class="field">
                <input ligerui="width:370" name="buOrgCd" id="buOrgCd" data-value="${insChnOpenSettingVO.buOrgCd}"
                       placeholder="请选择" ltype="combobox" validate="{required:true}">
                <span class="requiredSymbol">*</span>
            </div>
        </div>
        <div class="fieldBox col_100_auto">
            <div class="label">适用项目类型</div>
            <div class="field">
                <input ligerui="width:370" name="prjTypCd" id="prjTypCd" data-value="${insChnOpenSettingVO.prjTypCd}"
                       placeholder="请选择" ltype="combobox" validate="{required:true}">
                <span class="requiredSymbol">*</span>
            </div>
        </div>
        <div class="fieldBox col_100_auto">
            <div class="label">适用业务类型</div>
            <div class="field">
                <input ligerui="width:370" name="bizTypCd" id="bizTypCd" data-value="${insChnOpenSettingVO.bizTypCd}"
                       placeholder="请选择" ltype="combobox" validate="{required:true}">
                <span class="requiredSymbol">*</span>
            </div>
        </div>
        <%--<div class="fieldBox col_100_auto">
            <div class="label">适用区域</div>
            <div class="field">
                <input ligerui="width:370" name="rgnCd" id="rgnCd" type="text" data-value="${insChnOpenSettingVO.rgnCd}" placeholder="请选择" ltype="combobox">
                <span class="requiredSymbol">*</span>
            </div>
        </div>--%>
        <div class="fieldBox col_100_auto">
            <div class="label">适用保单类型</div>
            <div class="field">
                <input ligerui="width:370" name="plcTypCd" id="plcTypCd" data-value="${insChnOpenSettingVO.plcTypCd}"
                       placeholder="请选择" ltype="combobox" validate="{required:true}">
                <span class="requiredSymbol">*</span>
            </div>
        </div>
        <div class="fieldBox col_100_auto">
            <div class="label">适用险种</div>
            <div class="field">
                <input ligerui="width:370" name="insTypCd" id="insTypCd" data-value="${insChnOpenSettingVO.insTypCd}"
                       placeholder="请选择" ltype="combobox" validate="{required:true}">
                <span class="requiredSymbol">*</span>
            </div>
        </div>
        <div class="fieldBox col_100_auto">
            <div class="label">备注</div>
            <div class="field">
                <textarea name="settingRem" id="settingRem" class="ui-textarea l-textarea" cols="100" rows="3"
                          style="width:97%;"
                          value="${insChnOpenSettingVO.settingRem}"
                          validate="{required:false,maxlength:180}">${insChnOpenSettingVO.settingRem}</textarea>
            </div>
        </div>
    </div>
    <div class="btnsBox">
        <span id="saveInsChnOpenSetting_Btn" class="sq-button sq-button-round l-dialog-btn-ok">保存</span>
        <input type="reset" id="resetBtn" class="l-button l-button-reset Hide">
    </div>
</form>
<script>
    $(function () {
        var insChnOpenSettingId = "${insChnOpenSettingVO.id}";//主键ID
        $("#prjTypCd").ligerComboBox({
            width: 400,
            selectBoxWidth: 240,
            selectBoxHeight: 150,
            treeLeafOnly: false, //限制只能选叶节点，父节点不能点击
            valueField: 'key',
            textField: 'value',
            onlyParentNode: true, //只保留树的父节点值
            tree: {
                data:${prjTypCdList},
                idFieldName: 'key',
                textFieldName: 'value',
                parentIcon: "none",
                childIcon: "none",
            },
        });
        $("#bizTypCd").ligerComboBox({
            selectBoxWidth: 240,
            selectBoxHeight: 150,
            treeLeafOnly: false, //限制只能选叶节点，父节点不能点击
            valueField: 'key',
            textField: 'value',
            onlyParentNode: true, //只保留树的父节点值
            tree: {
                data:${bizTypCdList},
                idFieldName: 'key',
                textFieldName: 'value',
                parentIcon: "none",
                childIcon: "none",
            },
        });
        $("#insTypCd").ligerComboBox({
            selectBoxWidth: 240,
            selectBoxHeight: 150,
            treeLeafOnly: false, //限制只能选叶节点，父节点不能点击
            valueField: 'key',
            textField: 'value',
            onlyParentNode: true, //只保留树的父节点值
            tree: {
                data:${insTypCdList},
                idFieldName: 'key',
                textFieldName: 'value',
                parentIcon: "none",
                childIcon: "none",
            },
        });
        $("#plcTypCd").ligerComboBox({
            selectBoxWidth: 240,
            selectBoxHeight: 150,
            treeLeafOnly: false, //限制只能选叶节点，父节点不能点击
            valueField: 'key',
            textField: 'value',
            onlyParentNode: true, //只保留树的父节点值
            tree: {
                data:${plcTypCdList},
                idFieldName: 'key',
                textFieldName: 'value',
                parentIcon: "none",
                childIcon: "none",
            },
        });
        $("#buOrgCd").ligerComboBox({
            selectBoxWidth: 240,
            selectBoxHeight: 150,
            treeLeafOnly: false, //限制只能选叶节点，父节点不能点击
            valueField: 'orgCd',
            textField: 'orgNm',
            onlyParentNode: true, //只保留树的父节点值
            tree: {
                url: '<%=path%>/insurance/insChnOpenSetting/getOrgList.do',
                ajaxType: 'get',
                idFieldName: 'orgCd',
                textFieldName: 'orgNm',
                parentIcon: "none",
                childIcon: "none",
                isExpand: "false"
            },
        });

        /*$("#rgnCd").ligerComboBox({
            selectBoxWidth: 240,
            selectBoxHeight: 150,
            treeLeafOnly: false, //限制只能选叶节点，父节点不能点击
            valueField: 'rgnCd',
            textField: 'rgnNm',
            onlyParentNode: true, //只保留树的父节点值
            tree: {
                url: '<%=path%>/insurance/insChnOpenSetting/getRgnList.do',
                ajaxType: 'get',
                idFieldName: 'rgnCd',
                textFieldName: 'rgnNm',
                parentIcon: "none",
                childIcon: "none",
            },
        });*/

        $("#insChnOpenSetting_form").ligerForm({
            validate: true
        });

        /*保存*/
        $("#saveInsChnOpenSetting_Btn").click(function (event) {
            var form = liger.get("insChnOpenSetting_form");
            if (!form.valid()) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            var data = form.getData();
            $.ligerDialog.hide();
            var _url;
            if (insChnOpenSettingId == '') {//新增
                _url = '<%=path%>/insurance/insChnOpenSetting/add.do';
            } else {//修改
                _url = '<%=path%>/insurance/insChnOpenSetting/modify.do?id=' + insChnOpenSettingId;
            }
            var wait_dialog;
            $.ajax({
                type: 'post',
                dataType: 'json',
                data: data,
                url: _url,
                beforeSend: function () {
                    wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                },
                success: function (msg) {
                    wait_dialog.close();
                    if (msg.success == 1) {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                        parent.$("#clearBtn").click();
                        parent.$("#searchBtn").click();
                        frameElement.dialog.close();
                    } else {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        });
    });
</script>
</body>
</html>
